Post

Replies

Boosts

Views

Activity

How to print a QRCode to the proper size?
Hi, I'm having trouble printing a QRCode to the proper size. I pass it, as a UIImage, to a UIActivityViewController and it prints, but at the full width of the A4 page. I've been looking into all kinds of ways to try and shrink it down, but without success. Is there an image equivalent of UISimpleTextPrintFormatter or something along those lines that makes it simple? Do I need to use a UIViewPrintFormatter? Any help greatly appreciated.
0
0
677
Aug ’21
Programmatically closing an app.
Here's my context: User imports a backup file via airdrop, from a laptop to the mobile. My app opens and asks for a password to import and decrypt the file. The user decides to cancel instead, so taps the cancel button. How do I close the app at that point? I have done a lot of googling but so far have not found out how to do it.
10
0
19k
Oct ’21
ControlTextDidEndEditing (how to determine which textfield called)
Hi, I have a number of NSTextFields on a ViewController and I'm searching for a way to determine which textfield called the DidEndEditing method. Is there a way to do it without adding an IBOutlet for each TextField? func controlTextDidEndEditing(_ obj: Notification) {      } Also, the IBOutlet question raises another question. Is there an equivalent of UIKits IBOutletCollection for AppKit? I've been googling away but haven't found much about it so far. Cheers for any help.
Topic: UI Frameworks SubTopic: AppKit Tags:
1
0
548
Oct ’22
Using NSTextFieldDelegate with NSSecureTextField
Hi, I've been making good progress with learning how to use NSTextFieldDelegate with NSTextField, but I'm struggling with how to use it with NSSecureTextField. Can anyone point me in the right direction? I need to be able to grab the stringValue and work with it when the return key is pressed. The code below works fine for an NSTextField. I obviously need to use a different function, or a different responder type perhaps? func control(_ control: NSControl, textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool {       if (commandSelector == #selector(NSResponder.insertNewline(_:))) {    guard let sender = control as? NSSecureTextField else {return false}    if sender.tag == 1 {     print("It equals 1")    }         if sender.stringValue != "" {       print("field is not empty")      }      self.view.window?.makeFirstResponder(sender.nextKeyView)            return true    }    return false  }
Topic: UI Frameworks SubTopic: AppKit Tags:
1
0
767
Oct ’22
How to disable UIAlertController Buttons?
Hi all, I'm struggling to find a way to disable buttons in a UIAlertController of .alert style. I have a textfield, for entering the current password, a button for changing the current password and a button for deleting it. I'd like to disable both password buttons until the current password is correctly entered into the textfield, but I'm struggling to find the solution. If anyone can point me in the right direction it would be much appreciated.
Topic: UI Frameworks SubTopic: UIKit Tags:
7
0
5.5k
Apr ’23